package com.attendance.mapper;

import com.attendance.pojo.Department;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 部门映射器
 *
 * @author 今朝
 * @date 2021/03/17
 */
@Mapper
public interface DepartmentMapper extends BaseMapper<Department> {

    /**
     * 找到离开num父id
     *
     * @param parentId 父id
     * @return {@link Long}
     */
    Long findDepartNumsByParentId(Long parentId);

    /**
     * 通过父节点id寻找部门
     *
     * @param parentId 父id
     * @return {@link List<Department>}
     */
    List<Department> findDepartByParentId(Long parentId);

    /**
     * 找到部门树根
     *
     * @return {@link List<Department>}
     */
    List<Department> findDepartTreeRoots();
}
